var fs = require('fs');

var rOption = {
	flags : "r",
	encoding:null,
	mode:0666
}

var wOption = {
	flags : "a",
	encoding:null,
	mode:0666
}

var fileReadStream = fs.createReadStream('filecopy/1/result.html',rOption);
var fileWriteStream = fs.createWriteStream('filecopy/2/new_result.html',wOption);

fileReadStream.on('data',function(data) {
	fileWriteStream.write(data);
});

fileReadStream.on('end',function() {
	console.log('readStream end');
	fileWriteStream.end();
});




// var fs = require('fs');  
  
// var fileReadStream=fs.createReadStream('filecopy/1/result.txt');  
// var fileWriteStream = fs.createWriteStream('filecopy/2/new_result.txt');  
// fileReadStream.pipe(fileWriteStream);  
  
// fileWriteStream.on('close',function(){  
//   console.log('copy over');    
// });